% Test the function makeppft filter.
%
% Yoel Shkolnisky, December 2010.

for n=2:2:256
    A=rand(n,n);
    
    tic;
    [pp1 pp2]=optimizedPPFT2D(A);
    B=optimizedAdjointPPFT2D(pp1,pp2);
    t1 = toc;

    H=makePPFTFilter2D(n);

    hp=zeros(3*n,3*n);
    hp(n/2+1:5*n/2,n/2+1:5*n/2)=H.filter;
    Hhat=fftn(ifftshift(hp));
    
    tic;
    Ap=zeros(3*n,3*n);
    Ap(n+1:2*n,n+1:2*n)=A;
    Cc=fftshift(ifftn(fftn(ifftshift(Ap)).*Hhat));
    Cc=Cc(n+1:2*n,n+1:2*n);
    t2=toc;

    reportTestResult(n,(norm(B(:)-Cc(:))./norm(B(:))),t1/t2);    
end